Tables
------

Here's a grid table followed by a simple table:

+------------------------+------------+----------+----------+
| Header row, column 1   | Header 2   | Header 3 | Header 4 |
| (header rows optional) |            |          |          |
+========================+============+==========+==========+
| body row 1, column 1   | column 2   | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2             | Cells may span columns.          |
+------------------------+------------+----------+----------+
| body row 5             | Cells may also be     |          |
|                        | empty: ``-->``        |          |
+------------------------+-----------------------+----------+

=====  =====  ======
   Inputs     Output
------------  ------
  A      B    A or B
=====  =====  ======
False  False  False
True   False  True
False  True   True
True   True   True
=====  =====  ======

a table without head

.. table:: Foo

   +-----+-----+
   |     |     |
   +-----+-----+
   |     |     |
   +-----+-----+

a narrow table

=== ===
CL1 CL2
=== ===
ys  asd
--- ---
sda ase
=== ===

poses problems

=== ===
 A   B
=== ===
 0   0
 1   0
=== ===

=== === ===
 A   B  
=== === ===
 0   0   0
 1   0   1
=== === ===


============================ ==================================== ===========================================
 a wide table                    poses other problems                .
============================ ==================================== ===========================================
 as reST assumes the          the LaTeX writer assumes             if the actual table is wider
 the documents being          line length being 80 chars
 readable before                                                   it must be scaled down
 processing          
---------------------------- ------------------------------------ -------------------------------------------
 narrow ones need             a little amplification as TeX's      proportional fonts seem to need more
                                                                   horizontal space.
============================ ==================================== ===========================================

+--------------------------+----------------------------+
|::                        |::                          |
|                          |                            |
|  mpl::plus<_,_>          |  mpl::plus<_1,_2>          |
+--------------------------+----------------------------+
|::                        |::                          |
|                          |                            |
|  boost::is_same<         |  boost::is_same<           |
|      _                   |      _1                    |
|    , add_pointer<_>      |    , add_pointer<_1>       |
|  >                       |  >                         |
+--------------------------+----------------------------+

a longer and complicated table thanks to dave abrahams

+--------------------------+----------------------------+-------------------------+
|Metafunction              |Result `` ::type``          |Complexity               |
+==========================+============================+=========================+
|``find<seq, T>``          |An iterator to the first    |Linear                   |
|                          |occurrence of ``T`` in      |                         |
|                          |``seq``, or                 |                         |
|                          |``end<seq>::type`` if not   |                         |
|                          |found.                      |                         |
+--------------------------+----------------------------+-------------------------+
|``find_if<seq, T, pred>`` |An iterator to the first    |Linear                   |
|                          |element of ``seq`` that     |                         |
|                          |satisfies predicate         |                         |
|                          |``pred``, or                |                         |
|                          |``end<seq>::type`` if not   |                         |
|                          |found.                      |                         |
+--------------------------+----------------------------+-------------------------+
|``contains<seq, T>``      |True iff ``seq`` contains   |Linear                   |
|                          |``T``.                      |                         |
+--------------------------+----------------------------+-------------------------+
|``count<seq, T>``         |The number of occurences of |Linear                   |
|                          |``T`` in ``seq``.           |                         |
+--------------------------+----------------------------+-------------------------+
|``count_if<seq, pred>``   |The number of elements in   |Linear                   |
|                          |``seq`` that satisfy        |                         |
|                          |predicate ``pred``.         |                         |
+--------------------------+----------------------------+-------------------------+
|``equal<seq1, seq2>``     |True iff ``seq1`` and       |Linear                   |
|                          |``seq2`` contain the same   |                         |
|                          |elements in the same order. |                         |
+--------------------------+----------------------------+-------------------------+
|::                        |The earliest                |Logarithmic in           |
|                          |order-preserving position at|invocations to           |
|  lower_bound<            |which ``T`` could be        |``compare``. Logarithmic |
|      seq, T              |inserted in a sequence      |traversal of             |
|    , compare = less<_,_> |``seq`` sorted according to |random-access            |
|  >                       |comparison ``compare``.     |sequences. Linear        |
|                          |                            |traversal otherwise.     |
+--------------------------+----------------------------+-------------------------+
|::                        |The latest order-preserving |Logarithmic in           |
|                          |position at which ``T``     |invocations to           |
|  upper_bound<            |could be inserted in a      |``compare``. Logarithmic |
|      seq, T              |sequence ``seq`` sorted     |traversal of             |
|    , compare = less<_,_> |according to comparison     |random-access            |
|  >                       |``compare``.                |sequences. Linear        |
|                          |                            |traversal otherwise.     |
+--------------------------+----------------------------+-------------------------+
|::                        |The first position ``i`` in |Linear                   |
|                          |``seq`` such that for all   |                         |
|  max_element<            |positions ``j``::           |                         |
|      seq                 |                            |                         |
|    , compare = less<_,_> |  apply<                    |                         |
|  >                       |      compare               |                         |
|                          |    , deref<i>::type        |                         |
|                          |    , deref<j>::type        |                         |
|                          |  >::type::value == false   |                         |
+--------------------------+----------------------------+-------------------------+
|::                        |The first position ``i`` in |Linear                   |
|                          |``seq`` such that for all   |                         |
|  min_element<            |positions ``j``::           |                         |
|      seq                 |                            |                         |
|    , compare = less<_,_> |  apply<                    |                         |
|  >                       |      compare               |                         |
|                          |    , deref<j>::type        |                         |
|                          |    , deref<i>::type        |                         |
|                          |  >::type::value == false   |                         |
+--------------------------+----------------------------+-------------------------+

hyphens as content in a grid table cell

+----------------+------------------+
| John Smith     | Mary Scott-Smith |
+----------------+------------------+

